package com.tdkj.action.backstage.decorate;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.decorate.BeanModule;
import com.tdkj.service.decorate.IBeanModuleService;


public class ModuleAction extends BaseAction {
    
	private IBeanModuleService moduleService;
	
	private List<BeanModule> modules ;
	
	private BeanModule module ;
	
	
	public String execute() {
		modules = moduleService.findAll(BeanModule.class);
		return "success";
	}
	
	public String add() {
		moduleService.save(module);
		return execute();
	}
	
	public String update() {
		moduleService.saveOrUpdate(module, BeanModule.class);
		return execute();
	}

	public String delete() {
		moduleService.delete(module.getId(), BeanModule.class);
		return execute();
	}
	
	public String edit() {
		module = moduleService.findById(module.getId(), BeanModule.class);
		return "edit";
	}

	public List<BeanModule> getModules() {
		return modules;
	}

	public void setModules(List<BeanModule> modules) {
		this.modules = modules;
	}

	public BeanModule getModule() {
		return module;
	}

	public void setModule(BeanModule module) {
		this.module = module;
	}

	@Resource
	public void setModuleService(IBeanModuleService moduleService) {
		this.moduleService = moduleService;
	}

	
	
}
